package com.xunwulian.base.util;


import java.util.Date;

public class SeqUtil {

    /**
     * seq
     * |f |   12bit  date  |    18bit seq |
     * |31|30------------19|18------------|
     * -----
     *
     * @return
     */
    public static long getSeq() {
        long seq = 0x00;
        int date = DateUtil.getYear(new Date()) * 10000 + DateUtil.getDay(new Date());
        seq = seq | date << 18;
        seq = seq | DateUtil.getSecond(new Date()) % 2 ^ 18;
        return seq;
    }

    public static void main(String[] args) {
        SeqUtil seqUtil = new SeqUtil();
        System.out.println(seqUtil.getSeq());
    }

}
